<?PHP

	include("../../includes/configAjax.php");

	switch($_GET['type']){
		
		case'username':
			$desiredUname = $db->prep($_GET['q']);
			$desiredUname = strtolower($desiredUname);
			$result = $db->query("SELECT * FROM ".$prefix."users WHERE username_clean='".$desiredUname."'");
			if(mysql_num_rows($result)>0 || strlen($desiredUname)<3){
				echo "yes";	
			} else {
				echo "no";
			}
		break;
		
		case 'email':
			$desiredEmail = $db->prep($_GET['q']);
			$result = $db->query("SELECT * FROM ".$prefix."users WHERE email='".$desiredEmail."'");
			if(mysql_num_rows($result)>0 || strlen($desiredEmail)<3){
				echo "yes";	
			} else {
				echo "no";
			}
		break;
		
	}

?>